package org.hawk.gwt.ppc.scanner.utils;

import junit.framework.TestCase;

public class JavaTokenizerTestCase extends TestCase {

	public void testTokenizeTypeParams() {
		JavaTokenizer tokenizer = new JavaTokenizer("List<? extends Map>");
		assertEquals("List", tokenizer.next());
		assertEquals("<", tokenizer.next());
		assertEquals("?", tokenizer.next());
		assertEquals("extends", tokenizer.next());
		assertEquals("Map", tokenizer.next());
		assertEquals(">", tokenizer.next());
		assertFalse(tokenizer.hasNext());
		
		JavaTokenizer tokenizer2 = new JavaTokenizer("List<? extends Map< ? super   java.lang.String   , \n" +
				"?>>");
		
		assertEquals("List", tokenizer2.next());
		assertEquals("<", tokenizer2.next());
		assertEquals("?", tokenizer2.next());
		assertEquals("extends", tokenizer2.next());
		assertEquals("Map", tokenizer2.next());
		assertEquals("<", tokenizer2.next());
		assertEquals("?", tokenizer2.next());
		assertEquals("super", tokenizer2.next());
		assertEquals("java", tokenizer2.next());
		assertEquals(".", tokenizer2.next());
		assertEquals("lang", tokenizer2.next());
		assertEquals(".", tokenizer2.next());
		assertEquals("String", tokenizer2.next());
		assertEquals(",", tokenizer2.next());
		assertEquals("?", tokenizer2.next());
		assertEquals(">", tokenizer2.next());
		assertEquals(">", tokenizer2.next());
	}
}
